package br.fmapn.web.mb;

import java.util.ArrayList;
import java.util.List;

import javax.faces.event.ActionEvent;


import br.fmapn.process.entities.BusinessOperation;
import br.fmapn.register.BusinessProcessServicesRemote;
import br.fmapn.web.util.GerenciadorLookup;

/**
 * 
 * @author heitor
 *
 */
public class MBManterOperacao {

	private BusinessOperation businessOperation;
	
	private List<BusinessOperation> businessOperations;
	private BusinessProcessServicesRemote businessProcessServices;

	public MBManterOperacao() {

		this.businessOperation = new BusinessOperation();
		this.businessOperations = new ArrayList<BusinessOperation>();
		
		
		businessProcessServices = GerenciadorLookup
				.obterBusinessProcessServices();
	}
	
	

	public BusinessOperation getBusinessOperation() {
		return businessOperation;
	}



	public void setBusinessOperation(BusinessOperation businessOperation) {
		this.businessOperation = businessOperation;
	}



	public void cadastrarOperacao(ActionEvent evento) {

		businessProcessServices.saveBusinessOperation(businessOperation);
		businessOperation = new BusinessOperation();
	}



	public List<BusinessOperation> getBusinessOperations() {
		this.businessOperations = businessProcessServices.getBusinessOperations();
		return businessOperations;
	}



	public void setBusinessOperations(List<BusinessOperation> businessOperations) {
		this.businessOperations = businessOperations;
	}
}
